<template>
  <div>
    <a-textarea
      ref="editor"
      v-model="text"
      v-if="showEdit"
      style="min-width: 100px"
      @blur="hideEditor"
      autosize
    ></a-textarea>
    <span @dblclick="showEditor" v-else>{{ text }}</span>
  </div>
</template>

<script>
export default {
  name: 'TextComponent',
  data() {
    return {
      showEdit: false,
      text: '文本'
    }
  },
  methods: {
    showEditor() {
      this.showEdit = true
      // this.$refs.editor.target.focus()
      console.log(this.$refs)
    },
    hideEditor() {
      this.showEdit = false
    }
  }
}
</script>

<style></style>
